﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;

namespace Tikcers
{
    public partial class TicketForm : Form
    {
        DataTable m_dtLabels;
        public TicketForm(DataTable dtLabels)
        {
            InitializeComponent();
            m_dtLabels = dtLabels;
        }

        private void TicketForm_Load(object sender, EventArgs e)
        {
            bool m_IsVaoucher = true;
            try
            {
                //DataSet dsReport = new Dataset1();
                DataSet dsReport = new DataSet();
                if (m_IsVaoucher == true)
                {
                    foreach (DataRow currRow in m_dtLabels.Rows)
                    {
                        dsReport.Tables[0].Rows.Add(currRow.ItemArray);
                        dsReport.Tables[0].Rows.Add(currRow.ItemArray);
                        dsReport.Tables[0].Rows.Add(currRow.ItemArray);
                        if ((dsReport.Tables[0].Rows.Count + 3) % 36 == 0)
                        {
                            dsReport.Tables[0].Rows.Add(new object[] { "", "", "", "", "" });
                            dsReport.Tables[0].Rows.Add(new object[] { "", "", "", "", "" });
                            dsReport.Tables[0].Rows.Add(new object[] { "", "", "", "", "" });
                        }
                    }
                }
                else
                {
                    foreach (DataRow currRow in m_dtLabels.Rows)
                    {
                        dsReport.Tables[0].Rows.Add(currRow.ItemArray);
                        if ((dsReport.Tables[0].Rows.Count + 3) % 36 == 0)
                        {
                            dsReport.Tables[0].Rows.Add(new object[] { "", "", "", "", "" });
                            dsReport.Tables[0].Rows.Add(new object[] { "", "", "", "", "" });
                            dsReport.Tables[0].Rows.Add(new object[] { "", "", "", "", "" });
                        }
                    }
                }


                CrystalReport11.SetDataSource(dsReport);
                crystalReportViewer1.ReportSource = CrystalReport11;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Error!!!!", System.Windows.Forms.MessageBoxButtons.OK, System.Windows.Forms.MessageBoxIcon.Error);
            }
        }
    }
}
